package cn.itcast.nems.product.dao.entity;

import cn.itcast.nems.common.entity.LongIdEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * <p>
 * 产品定价规则
 * </p>
 *
 * @author liyong
 * @since 2023-08-31
 */
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("e2_product_price_rule")
public class ProductPriceRule extends LongIdEntity {

    /**
     * 产品ID
     */
    private Long productId;

    /**
     * 原价/划线价。单位：分
     */
    private Integer listPrice;

    /**
     * 标准价格：先付费价格。单位：分
     */
    private Integer price;

    /**
     * 后付费价格。单位：分
     */
    private Integer postpaidPrice;

    /**
     * 生效时间，格式：YYYY-MM-DD HH:MM:SS
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime effectiveDatetime;

    /**
     * 过期时间，格式：YYYY-MM-DD HH:MM:SS。注：没有填写过期日期时，该值为9999-12-31 23:59:59
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime expireDatetime;
}
